﻿Public Class frmPrincipal
    Private Sub btnAñadirEntrega_Click(sender As Object, e As EventArgs) Handles btnAñadirEntrega.Click
        Dim frm As New frmAñadirEntrega
        frm.ShowDialog()

    End Sub

    Private Sub btnAñadirUsuario_Click(sender As Object, e As EventArgs) Handles btnAñadirUsuario.Click
        Dim frm As New frmAñadirUsuario
        frm.ShowDialog()

    End Sub

    Private Sub btnAñadirCliente_Click(sender As Object, e As EventArgs) Handles btnAñadirCliente.Click
        Dim frm As New frmAñCliente
        frm.ShowDialog()

    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Dim frm As New frmClientePorTipo
        frm.ShowDialog()

    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        Dim frm As New frmObjetosPorFamilia
        frm.ShowDialog()

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim frm As New frmDetallesObjeto
        frm.ShowDialog()


    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim frm As New frmEntregasConObjetosSinRegistrar
        frm.ShowDialog()


    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim frm As New frmEntregasPorCliente
        frm.ShowDialog()


    End Sub

    Private Sub Button7_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub frmPrincipal_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Me.WindowState = FormWindowState.Maximized
        miAdmin = miGestion.obtenerAdministrador

        If IsNothing(miAdmin) Then
            Dim result2 As Integer = MessageBox.Show("Todavía no hay cuenta de administrador registrada, ¿Desea registrarla ahora?", "Atencion", MessageBoxButtons.YesNo)
            If result2 = DialogResult.Yes Then
                frmAñadirAdministrador.ShowDialog()
            Else


            End If
        End If

    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        miAdmin = miGestion.obtenerAdministrador

        If IsNothing(miAdmin) Then
            Dim result2 As Integer = MessageBox.Show("No puedes acceder al panel de administrador ya que no hay cuenta de administrador registrada, ¿Desea registrarla ahora?", "Atencion", MessageBoxButtons.YesNo)
            If result2 = DialogResult.Yes Then
                frmAñadirAdministrador.ShowDialog()


            End If

        Else
            Dim frmpre As New frmPrePanel
            frmpre.ShowDialog()

        End If

    End Sub
End Class